<template>
  <div class="patent">
    <Header @searchVal="searchVal" />
    <div class="Breadcrumbs">
      <!-- <Breadcrumb /> -->
      <el-button
        size="mini"
        class="pubBtn3"
        style="margin-right: 20px"
        type="button"
        @click="$router.push('/patent')"
        >返回</el-button
      >
      <el-breadcrumb separator="-">
        <!-- <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item> -->
        <el-breadcrumb-item :to="{ path: '/patent' }"
          ><span class="no-redirect">我的专利管理</span>
        </el-breadcrumb-item>
        <el-breadcrumb-item
          ><span class="no-redirect">专利列表</span>
        </el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="patent_left">
      <!-- @open="handleOpen" :unique-opened="true" -->
      <el-menu :unique-opened="true" class="el-menu-vertical-demo">
        <div v-if="checkList.length > 0" class="click_flex">
          <span style="font-weight: 600">已选</span>
          <span
            @click="emty"
            class="pubBtn"
            style="
              border-radius: 5px;
              padding: 5px;
              cursor: pointer;
              font-size: 14px;
            "
            >清除选中</span
          >
        </div>
        <div
          v-if="checkList.length > 0"
          v-for="(item, index) in checkList"
          class="checkedList_box"
        >
          <p class="checkedList">{{ item.name }}</p>
          <i @click="remove(item)" class="el-icon-close"></i>
        </div>
        <div
          style="
            padding: 25px;
            border-bottom: 1px solid #d3dbeb;
            font-weight: 600;
          "
        >
          筛选项
        </div>
        <el-submenu
          v-for="(item, index) in menu"
          :index="index.toString()"
          :popper-append-to-body="true"
          :key="index"
        >
          <template slot="title">
            <span>{{ item.title }}</span>
          </template>
          <el-menu-item-group>
            <el-menu-item
              v-for="(i, c) in item.list"
              :index="index.toString()"
              :key="c"
            >
              <el-checkbox
                @click.native="clickget(i, $event)"
                v-model="i.checked"
              >
                <span class="set_span">{{ i.name }}</span>
                <span class="screen_item_span">{{ i.count }}</span>
              </el-checkbox>
            </el-menu-item>
          </el-menu-item-group>
        </el-submenu>
      </el-menu>
    </div>
    <el-main style="margin-left: 210px">
      <el-row style="margin-left: 60px">
        <el-col :lg="24">
          <el-col :lg="3" :xl="3"
            ><p class="Subhead" v-if="getPatentList">
              共{{ length }}条专利信息
            </p></el-col
          >
          <!-- class="ml" -->
          <el-col :lg="7" :xl="7" style="margin-right: 20px">
            <div style="display: flex; align-items: center">
              <el-input
                @clear="clear"
                clearable
                type="text"
                v-model="searchVals"
                placeholder="在列表中搜索"
                class="input-with-select"
              >
                <el-button slot="append" @click="search">检索</el-button>
                <i slot="prefix-icon" class="el-icon-search"></i>
                <!--  <i
                    v-if="searchVals"
                    class="el-icon-error el-input__icon"
                     slot="suffix"
                     @click="searchVals = '' ">
                   </i> -->
              </el-input>
            </div>
          </el-col>
          <!-- <el-col  :lg="4" :xl="3">
              <el-button @click="setprimarys" :type="primarys">专利价值度</el-button>
           </el-col> -->
          <el-col :lg="3" style="margin-right: 20px">
            <el-cascader
              clearable
              placeholder="选择分类"
              v-model="expandValue"
              :options="options2"
              :props="{ expandTrigger: 'hover' }"
              @change="handleChange"
            ></el-cascader>
          </el-col>
          <el-col :lg="3" style="margin-right: 20px">
            <el-select
              clearable
              v-model="value"
              @change="handelOption"
              placeholder="请选择排序"
            >
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-col>
          <el-col :lg="1">
            <!-- <el-select v-model="viewValue" @change="handelView" placeholder="请选择视图">
                  <el-option
                    v-for="item in view"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select> -->
            <div class="vs_iconfont">
              <el-tooltip
                class="item"
                effect="dark"
                content="预览"
                placement="bottom"
              >
                <i
                  class="iconfont icon-yulan"
                  :class="is_show == 2 ? 'vs_action' : ''"
                  @click="is_show = 2"
                ></i>
              </el-tooltip>
              <el-tooltip
                class="item"
                effect="dark"
                content="视图"
                placement="bottom"
              >
                <i
                  class="iconfont icon-shitu"
                  :class="is_show == 1 ? 'vs_action' : ''"
                  @click="is_show = 1"
                ></i>
              </el-tooltip>
            </div>
          </el-col>
          <el-col style="text-align:right;margin-left:20px;" :lg="6" :xl="5">
            <el-button @click="setprimarys" type="primary">导出当前专利</el-button>
          </el-col>
        </el-col>
      </el-row>

      <el-row v-if="is_show == 2" style="margin: 30px 60px">
        <el-col
          :lg="20"
          class="hovers"
          v-for="(item, index) in getPatentList"
          :key="index"
        >
          <p><span class="cril"></span>#{{ index + 1 }}</p>
          <div class="patent_info">
            <div class="info_img">
              <el-image
                @click.native="clickDetails(item)"
                style="width: 140px; height: 208px; margin-top: 10px"
                :src="item.imgo"
                fit="contain"
              ></el-image>
            </div>
            <div class="info_text">
              <div
                class="info_text_div"
                @click="clickDetails(item)"
                style="display: flex; align-items: center;justify-content: space-between;"
              >
                <!-- <i class="iconfont icon-xingxing"></i> -->
                <!-- <i v-if="is_admin_view==0"  @click.stop="Collection(item.id)" style="margin-right:10px;" :class="item.is_like == 0?'iconfont icon-xingxing':'iconfont icon-xingxing active'"></i> -->
                <div>
                         <span class="Subhead">{{ item.pns }}</span>
                <el-tag
                  class="patent_tag_sq"
                  effect="dark"
                  style="border: none"
                  size="small"
                  color="#4ba22f"
                  v-if="item.status == '授权'"
                  >{{ item.status }}</el-tag
                >
                <el-tag
                  class="patent_tag_sq"
                  effect="dark"
                  style="border: none"
                  size="small"
                  color="#4ba22f"
                  v-if="item.status == '部分无效'"
                  >{{ item.status }}</el-tag
                >
                <el-tag
                  class="patent_tag_sq"
                  effect="dark"
                  style="border: none"
                  size="small"
                  color="#4ba22f"
                  v-if="item.status == '权利恢复'"
                  >{{ item.status }}</el-tag
                >
                <el-tag
                  class="patent_tag_sq"
                  effect="dark"
                  style="border: none"
                  size="small"
                  color="#6c778b"
                  v-if="item.status == '未缴年费'"
                  >{{ item.status }}</el-tag
                >
                <el-tag
                  class="patent_tag_sq"
                  effect="dark"
                  style="border: none"
                  size="small"
                  color="#6c778b"
                  v-if="item.status == '撤回'"
                  >{{ item.status }}</el-tag
                >
                <el-tag
                  class="patent_tag_sq"
                  effect="dark"
                  style="border: none"
                  size="small"
                  color="#6c778b"
                  v-if="item.status == '驳回'"
                  >{{ item.status }}</el-tag
                >
                <el-tag
                  class="patent_tag_sq"
                  effect="dark"
                  style="border: none"
                  size="small"
                  color="#6c778b"
                  v-if="item.status == '期限届满'"
                  >{{ item.status }}</el-tag
                >
                <el-tag
                  class="patent_tag_sq"
                  effect="dark"
                  style="border: none"
                  size="small"
                  color="#6c778b"
                  v-if="item.status == '避重授权'"
                  >{{ item.status }}</el-tag
                >
                <el-tag
                  class="patent_tag_sq"
                  effect="dark"
                  style="border: none"
                  size="small"
                  color="#6c778b"
                  v-if="item.status == '全部撤销'"
                  >{{ item.status }}</el-tag
                >
                <el-tag
                  class="patent_tag_sq"
                  effect="dark"
                  style="border: none"
                  size="small"
                  color="#da7b21"
                  v-if="item.status == '实质审查'"
                  >{{ item.status }}</el-tag
                >
                <el-tag
                  class="patent_tag_sq"
                  effect="dark"
                  style="border: none"
                  size="small"
                  color="#da7b21"
                  v-if="item.status == '公开'"
                  >{{ item.status }}</el-tag
                >
                <el-tag
                  style="
                    height: 25px;
                    line-height: 25px;
                    margin-right: 5px;
                    margin-bottom: 5px;
                  "
                  size="small"
                  v-for="(t, s) in item.event"
                  :key="s"
                  v-if="item.event.length > 0"
                  effect="plain"
                  type=""
                  >{{ t }}</el-tag
                >
                </div>
                 <div style="display: flex; align-items: center;justify-content: space-between;">
                <div style="width: 100px" v-if="is_admin_view == 0" @click.stop>
                  <el-rate
                    void-color="#666"
                    disabled-void-color="red"
                    @change="rateChange(item)"
                    v-model="item.is_like"
                    :max="3"
                  ></el-rate>
                </div>
                      <el-button
                  type="primary"
                  size="mini"
                   icon="el-icon-delete"
                  @click.stop="remove_like(item, index)"
                  ></el-button
                >
               </div>
              </div>
              <div class="info_text_div">
                <span @click="clickDetails(item)" class="sz">{{
                  item.tic
                }}</span>
              </div>
              <div class="info_text_div">
                <el-button
                  v-if="is_admin_view == 0"
                  @click="getId(item.id)"
                  size="mini"
                  type="primary"
                  >编辑分类</el-button
                >
                <span style="color: #2a8b2d">{{ item.cate }}</span>
              </div>
              <div class="info_text_div">
                <p
                  @click="clickDetails(item)"
                  class="context"
                  style="margin-bottom: 10px"
                >
                  公告日：{{ item.pd }}
                </p>
                <p @click="clickDetails(item)" class="context">
                  {{ item.apc }}
                </p>
              </div>
              <div class="info_text_div">
                <p class="context zy_color">摘要</p>
                <p @click="clickDetails(item)" class="context w">
                  {{ item.absc }}
                </p>
              </div>
              <div class="info_text_div" v-if="item.is_zx == 1">
                <el-button @click.stop="service(item)" type="primary"
                  >咨询专利保险</el-button
                >
              </div>
            </div>
          </div>
        </el-col>
      </el-row>
      <el-table
        v-if="is_show == 1"
        :header-cell-style="{ background: '#F3F8FE' }"
        @row-click="rowClick"
        :data="getPatentList"
        border
        height="700"
        style="width: 93%; margin: 40px auto"
      >
        <el-table-column align="center" label="核心专利标记">
          <template slot-scope="scope">
            <div class="">
              <div
                style="padding: 10px 0"
                v-if="is_admin_view == 0"
                @click.stop
              >
                <el-rate
                  void-color="#666"
                  disabled-void-color="red"
                  @change="rateChange(scope.row)"
                  v-model="scope.row.is_like"
                  :max="3"
                ></el-rate>
              </div>
                  <el-button
                type="primary"
                size="mini"
                icon="el-icon-delete"
                @click.stop="remove_like(item, index)"
                ></el-button
              >
            </div>
            <!-- <i v-if="is_admin_view == 0" @click.stop="Collection(scope.row.id)" :class="scope.row.is_like == 0?'iconfont icon-xingxing':'iconfont icon-xingxing active'"></i>
           <i v-else @click.stop :class="scope.row.is_like == 0?'iconfont icon-xingxing':'iconfont icon-xingxing active'"></i> -->
          </template>
        </el-table-column>
        <el-table-column prop="ano" align="center" label="申请号">
        </el-table-column>
        <el-table-column prop="tic" align="center" label="专利标题" width="300">
        </el-table-column>
        <el-table-column align="center" label="法律状态/事件">
          <template slot-scope="scope">
            <el-tag
              style="border: none"
              size="small"
              effect="dark"
              color="#4ba22f"
              v-if="scope.row.status == '授权'"
              >{{ scope.row.status }}</el-tag
            >
            <el-tag
              style="border: none"
              size="small"
              effect="dark"
              color="#4ba22f"
              v-if="scope.row.status == '部分无效'"
              >{{ scope.row.status }}</el-tag
            >
            <el-tag
              style="border: none"
              size="small"
              effect="dark"
              color="#4ba22f"
              v-if="scope.row.status == '权利恢复'"
              >{{ scope.row.status }}</el-tag
            >
            <el-tag
              style="border: none"
              size="small"
              effect="dark"
              color="#6c778b"
              v-if="scope.row.status == '未缴年费'"
              >{{ scope.row.status }}</el-tag
            >
            <el-tag
              style="border: none"
              size="small"
              effect="dark"
              color="#6c778b"
              v-if="scope.row.status == '撤回'"
              >{{ scope.row.status }}</el-tag
            >
            <el-tag
              style="border: none"
              size="small"
              effect="dark"
              color="#6c778b"
              v-if="scope.row.status == '驳回'"
              >{{ scope.row.status }}</el-tag
            >
            <el-tag
              style="border: none"
              size="small"
              effect="dark"
              color="#6c778b"
              v-if="scope.row.status == '期限届满'"
              >{{ scope.row.status }}</el-tag
            >
            <el-tag
              style="border: none"
              size="small"
              effect="dark"
              color="#6c778b"
              v-if="scope.row.status == '避重授权'"
              >{{ scope.row.status }}</el-tag
            >
            <el-tag
              style="border: none"
              size="small"
              effect="dark"
              color="#6c778b"
              v-if="scope.row.status == '全部撤销'"
              >{{ scope.row.status }}</el-tag
            >
            <el-tag
              style="border: none"
              size="small"
              effect="dark"
              color="#da7b21"
              v-if="scope.row.status == '实质审查'"
              >{{ scope.row.status }}</el-tag
            >
            <el-tag
              style="border: none"
              size="small"
              effect="dark"
              color="#da7b21"
              v-if="scope.row.status == '公开'"
              >{{ scope.row.status }}</el-tag
            >
            <!-- <el-tag size="small" v-if="scope.row.event" effect="plain" type="">{{scope.row.event}}</el-tag> -->
            <el-tag
              style="
                height: 25px;
                line-height: 25px;
                margin-right: 5px;
                margin-bottom: 5px;
              "
              size="small"
              v-for="(t, s) in scope.row.event"
              :key="s"
              v-if="scope.row.event.length > 0"
              effect="plain"
              type=""
              >{{ t }}</el-tag
            >
          </template>
        </el-table-column>
        <el-table-column prop="apc" align="center" label="当前申请(专利权)人">
        </el-table-column>
        <el-table-column prop="inc" align="center" label="发明人">
        </el-table-column>
        <el-table-column prop="ad" align="center" label="申请日">
        </el-table-column>
        <el-table-column prop="pd" align="center" label="公告(公开)日">
        </el-table-column>
        <!-- <el-table-column
          prop="pns"
          align="center"
          label="公开号"
          width="130">
        </el-table-column> -->
        <!-- <el-table-column
          prop="crc"
          align="center"
          width="160"
          label="代理机构">
        </el-table-column> -->
        <el-table-column align="center" label="操作">
          <template slot-scope="scope">
            <el-button
              v-if="scope.row.is_zx == 1"
              @click.stop="service(scope.row)"
              type="primary"
              >咨询专利保险</el-button
            >
            <p>{{ scope.row.cate }}</p>
            <el-button
              v-if="is_admin_view == 0"
              @click.stop="getId(scope.row.id)"
              type="primary"
              >编辑分类</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <div class="pagination">
        <el-pagination
          background
          style="text-align: left; margin-left: 65px"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="page.page"
          :page-size="page.page_row"
          layout="total, prev, pager, next, jumper"
          :total="parseInt(page.count)"
          align="left"
        ></el-pagination>
        <!-- parseInt(page.total/10) -->
      </div>
    </el-main>
    <Service />
    <el-dialog
      :close-on-click-modal="false"
      title="专利保险"
      :visible.sync="dialogVisible"
      width="40%"
      :before-close="handleClose"
    >
      <el-input
        type="textarea"
        :rows="2"
        resize="none"
        placeholder="请填写您想咨询的专利保险内容"
        v-model="textarea"
      >
      </el-input>
      <div class="dialog-footer">
        <span slot="footer">
          <el-button class="pubBtn2" @click="dialogVisible = false"
            >取 消</el-button
          >
          <el-button class="pubBtn" @click="submit">提 交</el-button>
        </span>
        <div class="introduce">
          <div class="ewm">
            <p>微信二维码</p>
            <img src="../../../../public/ewm.png" />
          </div>
          <div>
            <p class="context">电话：李先生 13836945698</p>
            <p class="context">邮箱：13836945698@163.com</p>
          </div>
        </div>
      </div>
    </el-dialog>
    <el-dialog
      :destroy-on-close="true"
      :close-on-click-modal="false"
      title="选择分类"
      :visible.sync="CreatCancle"
      width="40%"
      center
    >
      <div class="invoice-list">
        <ul class="invoice-header">
          <li class="invoice-item">名称</li>
          <li class="invoice-item">级别</li>
        </ul>
        <!-- <el-tree show-checkbox :data="data" :props="defaultProps" @node-click="handleNodeClick"></el-tree> -->
        <el-tree
          :data="options2"
          show-checkbox
          :default-expanded-keys="expandedKeys"
          :default-checked-keys="expandedKeys"
          node-key="id"
          ref="tree"
          highlight-current
          @check-change="handleCheckChange"
          :props="props"
        >
        </el-tree>
        <!--  <el-tree
                :props="props"
                :data="options2"
                show-checkbox
                :default-expanded-keys="[3]"
                ref="treeData"
                @check-change="handleCheckChange">
               <div class="custom-tree-node" slot-scope="{ node, data }">
                    <span  class="table_info_node">
                      <span class="table_info_item">{{data.label}}</span>
                      <span class="table_info_item">{{data.level}}</span>
                    </span>
                </div>
              </el-tree> -->
      </div>

      <span slot="footer" class="dialog-footer">
        <el-button type="button" class="pubBtn2" @click="CreatCancles"
          >取消</el-button
        >
        <el-button type="button" class="pubBtn" @click="CreatSave"
          >确定</el-button
        >
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
import Header from "@/components/Header";
import Breadcrumb from "@/components/Breadcrumb";
import Service from "@/components/Service";
import { getLeft, UserPatentList } from "@/api";
import {
  intelligence,
  patentCore,
  patentCate,
  updatePatentCategory,
  defaultCate,
  patentExport,
} from "@/api/user";
import rightMenu from "@/components/web/rightMenu";
import { indexCreate } from "@/api";
export default {
  computed: {
    ...mapGetters([
      "sidebar",
      "avatar",
      "name",
      "roles",
      "type",
      "is_admin_view",
    ]),
    // ...mapState(['seach'])
  },
  components: {
    Header,
    Breadcrumb,
    Service,
    rightMenu
  },
  data() {
    return {
      value1: null,
      textarea: "",
      dialogVisible: false,
      list: [],
      view: [
        {
          value: 1,
          label: "视图",
        },
        {
          value: 2,
          label: "预览",
        },
      ],
      types: null,
      names: "",
      dataArr: [],
      length: null,
      is_inc: 0,
      getPatentList: [],
      value: "6",
      viewValue: "",
      is_show: 2,
      is_core: "",
      searchVals: "",
      page: [],
      menu: [],
      checkList: [],
      // 0:申请日从新到旧，1申请日从旧到新 ，2:公开日从新到旧，3公开日从旧到新，4:授权日从新到旧，5授权日从旧到新
      options: [
        {
          value: "6",
          label: "专利价值度从高到低",
        },
        {
          value: "0",
          label: "申请日从新到旧",
        },
        {
          value: "1",
          label: "申请日从旧到新",
        },
        {
          value: "2",
          label: "公开日从新到旧",
        },
        {
          value: "3",
          label: "公开日从旧到新",
        },
        {
          value: "4",
          label: "授权日从新到旧",
        },
        {
          value: "5",
          label: "授权日从旧到新",
        },
      ],
      options2: [],
      expandValue: "",
      CreatCancle: false,
      props: {
        label: "label", // 需要指定的节点渲染对象属性
        children: "children", // 指定的子级
      },
      primarys: "",
      pid: "",
      setArr: [],
      expandedKeys: [],
    };
  },
  async mounted() {
    this.types = this.$route.query.type;
    this.names = this.$route.query.name;
    this.is_inc = this.$route.query.is_inc;
    this.dataArr = [
      {
        name: this.$route.query.Tname,
        bs: this.$route.query.bs,
      },
    ];
    this.getMenu();
    try {
      if (this.types) {
        this.PatentList();
      } else {
        this.types = 0;
        this.PatentList();
      }
    } catch (e) {
      this.$message.error(e.message);
    }

    this.patentCate();
  },
  methods: {
     moveTo() {
      window.scrollTo(0, 0);
    },
    // tree组件选择改变事件
    handleCheckChange(val) {
      // console.log(this.$refs.tree.getCheckedKeys());
      this.setArr = this.$refs.tree.getCheckedKeys();
      // console.log(val)
      // 使用getCheckedNodes可以获取当前被选中的节点数据
      // let selected = this.$refs.treeData.getCheckedNodes()
      // selected.map(item=> {
      //   if(this.setArr.indexOf(item.id) != -1){
      //   	this.setArr.splice(this.setArr.indexOf(item.id), 1)
      //   }else{
      //     this.setArr.push(item.id)
      //   }
      // })
      //   // console.log(this.val)
    },
    handleClose() {
      this.dialogVisible = false;
      this.textarea = "";
    },
    async getId(id) {
      // console.log(id);
      this.CreatCancle = true;
      this.pid = id;
      this.expandedKeys = await defaultCate({ user_patent_id: id });
    },
    CreatCancles() {
      this.setArr = [];
      this.pid = "";
      this.CreatCancle = false;
    },

    async CreatSave() {
      try {
        const res = await updatePatentCategory({
          pid: this.pid,
          cid: Array.from(new Set(this.setArr)),
        });
        this.PatentList();
        this.setArr = [];
        this.pid = "";
        this.CreatCancle = false;
        this.$message.success("添加成功");
      } catch (e) {
        this.setArr = [];
        this.pid = "";
        this.$message.error(e.message);
      }
    },
    async patentCate() {
      const res = await patentCate();
      this.options2 = res.tableData;
    },
    async rateChange(item) {
      // console.log(item.is_like);
      try {
        const res = await patentCore({ pid: item.id, star: item.is_like });
        this.PatentList();
      } catch (e) {
        this.$message.error(e.message);
      }
    },
    async remove_like(item, index) {
      try {
        const res = await patentCore({
          pid: item.id,
          star: (this.getPatentList[index].is_like = 0),
        });
        this.PatentList();
      } catch (e) {
        this.$message.error(e.message);
      }
    },
    async Collection(id) {
      try {
        const res = await patentCore({ pid: id });
        this.PatentList();
      } catch (e) {
        this.$message.error(e.message);
      }
    },
    async submit() {
      try {
        await indexCreate({
          cid: 1,
          content: this.textarea,
          pns: this.list.pns,
          tic: this.list.tic,
          pid: this.list.pid,
          type: 1,
        });
        this.dialogVisible = false;
        this.textarea = "";
        this.$message.success("添加成功");
      } catch (e) {
        this.$message.error(e.message);
      }
    },
    async PatentList() {
      try {
        const res = await UserPatentList({
          keywords: this.searchVals,
          type: this.types,
          checkedArr: this.checkedArr,
          bid: this.names,
          order: this.value,
          queryData: this.dataArr,
          is_inc: this.is_inc,
          data: this.checkList,
          is_core: this.is_core,
          cid: this.expandValue[2],
        });
        this.getPatentList = res.list;
        this.page = res.page;
        this.length = res.page.count;
      } catch (e) {
        this.$message.error(e.message);
      }
    },
    async getMenu() {
      try {
        const res = await getLeft({
          bid: this.names,
          type: this.types,
          order: this.value,
          queryData: this.dataArr,
          is_inc: this.is_inc,
          keywords: this.searchVals,
        });
        this.menu = res.data;
      } catch (e) {
        this.$message.error(e.message);
      }
    },
    async search() {
      if (this.searchVals) {
        try {
          const res = await UserPatentList({
            keywords: this.searchVals,
            type: this.types,
            checkedArr: this.checkedArr,
            bid: this.names,
            order: this.value,
            queryData: this.dataArr,
            is_inc: this.is_inc,
            data: this.checkList,
            is_core: this.is_core,
            cid: this.expandValue[2],
          });
          this.getPatentList = res.list;
          this.page = res.page;
          this.length = res.page.count;
          this.getMenu();
        } catch (e) {
          this.$message.error(e.message);
        }
      }
    },
    clickDetails(item) {
       sessionStorage.setItem("pc", 0)
      this.$router.push({ path: "/detail", query: { pid: item.pid } });
    },
    async searchVal(val) {
      try {
        if (val) {
          const res = await intelligence({ keywords: val });
          this.getPatentList = res.list;
        }
      } catch (e) {
        this.$message.error(e.message);
      }
    },
    //每页下拉显示数据
    async handleSizeChange(size) {
      try {
        const res = await UserPatentList({
          page: size,
          bid: this.names,
          type: this.types,
          order: this.value,
          queryData: this.dataArr,
          is_inc: this.is_inc,
          keywords: this.searchVals,
          data: this.checkList,
          is_core: this.is_core,
          cid: this.expandValue[2],
        });
        this.getPatentList = res.list;
        this.page = res.page;
        this.length = res.page.count;
        document.documentElement.scrollTop = 0;
      } catch (e) {
        this.$message.error(e.message);
      }
    },
    //点击第几页
    async handleCurrentChange(currentPage) {
      try {
        const res = await UserPatentList({
          page: currentPage,
          bid: this.names,
          type: this.types,
          order: this.value,
          queryData: this.dataArr,
          is_inc: this.is_inc,
          keywords: this.searchVals,
          data: this.checkList,
          is_core: this.is_core,
          cid: this.expandValue[2],
        });
        this.getPatentList = res.list;
        this.page = res.page;
        this.length = res.page.count;
        document.documentElement.scrollTop = 0;
      } catch (e) {
        this.$message.error(e.message);
      }
    },
    service(item) {
      this.list = item;
      this.dialogVisible = true;
    },
    async clickget(i, e) {
      if (e.target.tagName === "INPUT") {
        if (i.checked == false) {
          try {
            this.checkList.push(i);
            const res = await getLeft({
              data: this.checkList,
              bid: this.names,
              type: this.types,
              order: this.value,
              queryData: this.dataArr,
              is_inc: this.is_inc,
              keywords: this.searchVals,
            });
            this.menu = res.data;
            const PatentList = await UserPatentList({
              keywords: this.searchVals,
              type: this.types,
              checkedArr: this.checkedArr,
              bid: this.names,
              data: this.checkList,
              order: this.value,
              queryData: this.dataArr,
              is_inc: this.is_inc,
              is_core: this.is_core,
              cid: this.expandValue[2],
            });
            this.getPatentList = PatentList.list;
            this.page = PatentList.page;
            this.length = PatentList.page.count;
          } catch (e) {
            this.$message.error(e.message);
          }
        } else {
          this.checkList.map((item, index) => {
            if (i.name == item.name) {
              this.checkList.splice(index, 1);
            }
          });
          const res = await getLeft({
            data: this.checkList,
            bid: this.names,
            type: this.types,
            order: this.value,
            queryData: this.dataArr,
            is_inc: this.is_inc,
            keywords: this.searchVals,
          });
          this.menu = res.data;

          const PatentList = await UserPatentList({
            keywords: this.searchVals,
            type: this.types,
            checkedArr: this.checkedArr,
            bid: this.names,
            data: this.checkList,
            order: this.value,
            queryData: this.dataArr,
            is_inc: this.is_inc,
            is_core: this.is_core,
            cid: this.expandValue[2],
          });
          this.getPatentList = PatentList.list;
          this.page = PatentList.page;
          this.length = PatentList.page.count;
        }
      }
    },
    async emty() {
      this.checkList = [];
      const res = await getLeft({
        data: this.checkList,
        bid: this.names,
        type: this.types,
        order: this.value,
        queryData: this.dataArr,
        is_inc: this.is_inc,
        keywords: this.searchVals,
      });
      this.menu = res.data;

      const PatentList = await UserPatentList({
        keywords: this.searchVals,
        type: this.types,
        checkedArr: this.checkedArr,
        bid: this.names,
        data: this.checkList,
        order: this.value,
        queryData: this.dataArr,
        is_inc: this.is_inc,
        is_core: this.is_core,
        cid: this.expandValue[2],
      });
      this.getPatentList = PatentList.list;
      this.page = PatentList.page;
      this.length = PatentList.page.count;
    },
    async remove(item) {
      this.checkList.splice(this.checkList.indexOf(item), 1);
      const res = await getLeft({
        data: this.checkList,
        bid: this.names,
        type: this.types,
        order: this.value,
        queryData: this.dataArr,
        is_inc: this.is_inc,
        keywords: this.searchVals,
      });
      this.menu = res.data;

      const PatentList = await UserPatentList({
        keywords: this.searchVals,
        type: this.types,
        checkedArr: this.checkedArr,
        bid: this.names,
        data: this.checkList,
        order: this.value,
        queryData: this.dataArr,
        is_inc: this.is_inc,
        is_core: this.is_core,
        cid: this.expandValue[2],
      });
      this.getPatentList = PatentList.list;
      this.page = PatentList.page;
      this.length = PatentList.page.count;
      // this.menu.map(item=>{
      //    item.list.map(i=>{
      //      if(i.name == name.name){
      //        i.checked = false
      //      }
      //    })
      // })
    },
    clear() {
      this.PatentList();
    },
    handelOption(val) {
      this.PatentList();
    },
    handleChange(val) {
      // console.log(this.expandValue[2])
      this.PatentList();
    },
    handelView(val) {
      this.is_show = val;
    },
    rowClick(row, event, column) {
      const pid = row.pid;
      const ano = row.ano;
       sessionStorage.setItem("pc", 0)
      this.$router.push({ path: "/detail", query: { pid: pid } });
    },
    async setprimarys() {
      try {
        const res = await patentExport({
          keywords: this.searchVals,
          type: this.types,
          checkedArr: this.checkedArr,
          bid: this.names,
          data: this.checkList,
          order: this.value,
          queryData: this.dataArr,
          is_inc: this.is_inc,
          is_core: this.is_core,
          cid: this.expandValue[2],
        });
        const blob = new Blob([res.data]);
        const fileName = `${this.name}专利统计.xls`;
        const elink = document.createElement("a");
        elink.download = fileName;
        elink.style.display = "none";
        elink.href = URL.createObjectURL(blob);
        document.body.appendChild(elink);
        elink.click();
        URL.revokeObjectURL(elink.href); // 释放URL 对象
        document.body.removeChild(elink);
        this.$message.success("导出成功");
      } catch (error) {
        this.$message.error(error.message);
      }
      // if(!this.primarys){
      //   this.is_core = 1
      //   this.primarys = 'primary'
      //   const PatentList =  await UserPatentList({keywords:this.searchVals,type:this.types,checkedArr:this.checkedArr,bid:this.names,data:this.checkList,order:this.value,queryData:this.dataArr,is_inc:this.is_inc,is_core:this.is_core,cid:this.expandValue[2]})
      //   this.getPatentList = PatentList.list;
      //   this.page = PatentList.page;
      //   this.length = PatentList.page.count
      // }else{
      //   this.is_core = 0
      //   this.primarys = ''
      //   const PatentList =  await UserPatentList({keywords:this.searchVals,type:this.types,checkedArr:this.checkedArr,bid:this.names,data:this.checkList,order:this.value,queryData:this.dataArr,is_inc:this.is_inc,is_core:this.is_core,cid:this.expandValue[2]})
      //   this.getPatentList = PatentList.list;
      //   this.page = PatentList.page;
      //   this.length = PatentList.page.count
      // }
    },
  },
};
</script>

<style lang="less">
// .el-rate__icon,
.icon-xingxing,
.el-icon-star-on {
  font-size: 25px !important;
}
.el-icon-star-off {
  font-size: 22px !important;
}
.patent_left {
  width: 260px;
  height: 90%;
  background-color: #fff;
  position: fixed;
  left: 0;
  top: 100px;
  border-right: 25px solid #f4f5f7;
  overflow-y: auto;
  padding-bottom: 60px;
  .checkedList_box {
    background-color: #f7f9fc;
    border: 1px solid #dcdfe6;
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 0 10px 10px;
    padding: 0 5px;
    .checkedList {
      width: 100%;
      margin: 5px 0;
      padding: 10px 0;
      // border-bottom:1px solid #3377ff;
      word-break: break-word;
      font-size: 12px;
      // color:#3377ff ;
    }
  }

  .click_flex {
    display: flex;
    margin: 20px 25px;
    justify-content: space-between;
    align-items: center;
  }
  .set_span {
    width: 130px;
    height: 40px;
    line-height: 40px;
    display: inline-block;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
  }
  // .el-menu-item
  .el-submenu {
    border-bottom: 1px solid #d3dbeb;
    margin-left: 10px;
  }
}

.screen_item {
  display: flex;
  justify-content: space-between;
  align-items: center;

  .el-checkbox__label {
    width: 140px;
  }

  .screen_item_span {
    margin-left: 10px;
  }

  span {
    color: #1f2e4c !important;
  }
}
.patent {
  .Breadcrumbs {
    margin-top: 100px;
    margin-left: 220px;
    background-color: #f4f5f7;
    padding-left: 38px;
  }
  .ml {
    margin: 0 40px;
  }
  .Subhead {
    line-height: 2.5;
  }
  .cril {
    width: 13px;
    height: 13px;
    background: rgba(51, 119, 255, 1);
    border-radius: 50%;
    display: inline-block;
  }
  .patent_info {
    display: flex;
    margin: 10px 0;
    .info_img {
      width: 188px;
      height: 237px;
      background: rgba(255, 255, 255, 1);
      border: 1px solid rgba(230, 233, 240, 1);
      border-radius: 5px;
      text-align: center;
    }
  }
  .info_text {
    margin-left: 30px;
    .info_text_div {
      margin-bottom: 19px;
    }
  }
  .patent_tag_sq {
    height: 24px;
    line-height: 24px;
    background: #45a321;
    border-radius: 4px;
    border: none;
  }
  .patent_tag_info {
    height: 24px;
    line-height: 24px;
    background: #6a7687;
    border-radius: 4px;
    border: none;
  }
  .patent_tag_orange {
    height: 24px;
    line-height: 24px;
    background: #ffa033;
    border-radius: 4px;
    border: none;
  }
  .Subhead {
    color: #2a8b2d;
    margin-right: 27px;
  }
  .sz {
    font-weight: 400;
    color: rgba(31, 46, 76, 1);
  }
  .zy_color {
    color: #3377ff;
    margin-bottom: 13px;
  }
  .w {
    width: 703px;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}
.hovers {
  padding: 20px 0 0 20px;
  cursor: pointer;
}
.hovers:hover {
  background-color: #f4f5f7;
}
.dialog-footer {
  text-align: left;
  margin-top: 20px;
}
.introduce {
  display: flex;
  align-items: flex-end;
  margin-top: 30px;
  .context {
    color: #3478ff;
  }
  .ewm {
    width: 95px;
    height: 95px;
    object-fit: cover;
    margin-right: 10px;
    img {
      width: 100%;
      width: 100%;
    }
  }
}
.el-icon-close {
  float: right;
  // color:#f56c6c !important;
}

.invoice-list {
  border: 1px solid #ebeef5;
  margin-top: 10px;
  .invoice-header {
    background-color: #f8f8f9;
    display: flex;
    padding-left: 46px;
    border-bottom: 1px solid #ebeef5;
    .invoice-item {
      padding: 10px;
      padding-right: 0;
      flex: 1;
      border-left: 1px solid #ebeef5;
      padding-left: 10px;
    }
  }
  .el-tree-node__content {
    // background: #f2f2f2;
    // padding-left:0 !important;
    height: 40px;
    border-bottom: 1px solid #ebeef5;
  }
  .el-tree-node__children {
    .el-tree-node__content {
      background: #fff;
      border-bottom: 1px solid #ebeef5;
    }
  }
  .custom-tree-node {
    width: 100%;
    height: 100%;
    .total_info_box {
      background: #f2f2f2;
      line-height: 40px;
      span {
        float: left;
        font-size: 12px;
        margin: 0 15px;
        // i{
        //   display: inline-block;
        //   margin-right: 3px;
        // }
      }
    }
    .table_info_node {
      display: flex;
      height: 100%;
      .table_info_item {
        flex: 1;
        height: 100%;
        border-left: 1px solid #ebeef5;
        padding-left: 10px;
        line-height: 40px;
      }
    }
  }
}
.el-rate__icon {
  color: #409eff !important;
}
</style>
